package com.guowei.jiecloudbackstage.staff.controller;


import com.guowei.jiecloudbackstage.common.api.vo.Result;
import com.guowei.jiecloudbackstage.staff.entity.Staff;
import com.guowei.jiecloudbackstage.staff.service.IStaffService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ym
 * @since 2021-04-25
 */
@RestController
@Api(tags = "Staff管理员登录验证 接口")
public class StaffController {

    @Autowired
    private IStaffService iStaffService;

    @PostMapping ("/api/Login")
    @ResponseBody
    public Result Login(@RequestBody Staff loginDTO){
        return iStaffService.Login(loginDTO);
    }

    @RequestMapping ("/api/getAllAdmin")
    @ResponseBody
    public Result getAllAdmin(){
        return iStaffService.getAllAdmin();
    }

    @PostMapping("/api/addAdmin")
    @ResponseBody
    public Result addAdmin(@RequestBody Staff staff){
        return iStaffService.addAdmin(staff);
    }

    @PostMapping("/api/updateAdminById")
    @ResponseBody
    public Result updateAdminById(@RequestBody Staff staff){
        return iStaffService.updateAdminById(staff);
    }

    @PostMapping("/api/deleteAdminById")
    @ResponseBody
    public Result deleteAdminById(@RequestBody Staff id){
        return iStaffService.deleteAdminById(id);
    }

}
